UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EPWPZdgAw2gxSE8snJtrIIrMGFYFayfbPoyl9RE76ZM='
WHERE
key_id = '17feb8d5173b1349b9485e14e65b8b40d76273e2328d66f2a638a752b199a696'
AND (
token = 'EPWPZdgAw2gxSE8snJtrIIrMGFYFayfbPoyl9RE76ZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)