UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uaPz+oq6GiPoxP0EL+wwOUblVq/1xqe36IBBIsBn2Gw='
WHERE
key_id = '51da8a74fa7aca7c76ead65fb6cd3dc7d0d9ebbdbfadf57f97bd132d7b574642'
AND (
token = 'uaPz+oq6GiPoxP0EL+wwOUblVq/1xqe36IBBIsBn2Gw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)