UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iKnZcwKbR9/MeIe3W8lXfdRNXrvKY7J+Am02h+jww+w='
WHERE
key_id = '1a99eb213f356467cf6bd63b7fced05facde660026f170e5d6a2b93b420078f4'
AND (
token = 'iKnZcwKbR9/MeIe3W8lXfdRNXrvKY7J+Am02h+jww+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)