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