UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lu2n5afjpZMn7KVz664K5/5vHyknMqgTnc8r43EQOtI='
WHERE
key_id = 'a8e08ed9520d6610c8b7f23e1b0867fceff49b8d2bd621fb604d12284f380a47'
AND (
token = 'Lu2n5afjpZMn7KVz664K5/5vHyknMqgTnc8r43EQOtI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)