UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XB3AkoeMS7uunz6nPZBrTVo+9W4ila2a0MuQt4vo71k='
WHERE
key_id = '337bb05aef5e80668363ebc911ea31e90037e68e95a1b54f53204824d8f7ceb5'
AND (
token = 'XB3AkoeMS7uunz6nPZBrTVo+9W4ila2a0MuQt4vo71k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)