UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ms0Bx8xR3vXwWzdAHig+2XE8sXjrj/iqdeMudscZPns='
WHERE
key_id = 'b84cf8c92d7e4fe879a18e786a552a597c75f0b650c78e63faf02359cd68a404'
AND (
token = 'ms0Bx8xR3vXwWzdAHig+2XE8sXjrj/iqdeMudscZPns='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)