UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VVwYVV0Shx7g5ve9IffBzB5+njzoMqBqnBeGTvlH4vk='
WHERE
key_id = 'a53f90df62629993bd8f0c7e559504ad2ba85b4b2811eaa3df16865e9f4b7e4b'
AND (
token = 'VVwYVV0Shx7g5ve9IffBzB5+njzoMqBqnBeGTvlH4vk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)