UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xtNAc/J/tqUxFAK4WF7aGBSPa4VwIIbszxEehELSZ/U='
WHERE
key_id = 'db65b51b429c812d08e83b44f1d0f18cda3060fc1057334e7d766a615a793aef'
AND (
token = 'xtNAc/J/tqUxFAK4WF7aGBSPa4VwIIbszxEehELSZ/U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)