UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R3zjXsmLiiXuk3oOpGpa1ArFn0YeCUqtiDUfUuceJuM='
WHERE
key_id = '7d99cdedb805e4fa7cb87525acf8fc04e54a74202909d0085ac733f012d550d5'
AND (
token = 'R3zjXsmLiiXuk3oOpGpa1ArFn0YeCUqtiDUfUuceJuM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)