UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hdCQ6BJEHmu0sb0JMKMgFWC6Tgj745jix6IJwRCAHa0='
WHERE
key_id = '4f0bb7c4db5d9e756a2531b85d2998cdc501a6eb25fb0029255181a122283ede'
AND (
token = 'hdCQ6BJEHmu0sb0JMKMgFWC6Tgj745jix6IJwRCAHa0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)