UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xgSy/HwCRneFUiffjrVdJe8UH+jSrlENLe1AUF2hYso='
WHERE
key_id = 'd5827c6ed7a5c559717805ed3e29310ad65de82dde698ae80c687d86833b1aee'
AND (
token = 'xgSy/HwCRneFUiffjrVdJe8UH+jSrlENLe1AUF2hYso='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)