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