UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'COj5ileURS1kslAnB+e/VpNhuG6CKUQ+yCtoDahMPWA='
WHERE
key_id = '5defd97e64ae909e4f0ea5bd13b9cd6440775fe16ca339c4556d83cb06408a8e'
AND (
token = 'COj5ileURS1kslAnB+e/VpNhuG6CKUQ+yCtoDahMPWA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)