UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SJZ0tEMwepXRvBI8gksOSOgLgMokvYRln2dlQGFk2wg='
WHERE
key_id = 'd17ad54d8a5827576bab6f121400a86577842ce14375412893087d6670ea86a2'
AND (
token = 'SJZ0tEMwepXRvBI8gksOSOgLgMokvYRln2dlQGFk2wg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)