UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n3h15x09xxuKbsesKAKj2JUfmTiM5LdN5rcH/CTdn/w='
WHERE
key_id = 'acfa6bf5d413bf4d0f21bbedf0017996ef395f0b4ba256599e52df3f007911ab'
AND (
token = 'n3h15x09xxuKbsesKAKj2JUfmTiM5LdN5rcH/CTdn/w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)