UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gaAmKPKz/KaBmE5wz6I483CBXkW9KqmTZJEhyk7TauU='
WHERE
key_id = 'a03cc7743348a518470f2acc8645f81e68525a44a192d983a73c66679a92aacf'
AND (
token = 'gaAmKPKz/KaBmE5wz6I483CBXkW9KqmTZJEhyk7TauU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)