UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a15BDqUsuA5t5mSh/rtqujEm/fDztE3Qih/fblbHGb4='
WHERE
key_id = 'c1567484b56103d0af1bcf41e5424e1b83a608202f87929d72e2a4d268a558f3'
AND (
token = 'a15BDqUsuA5t5mSh/rtqujEm/fDztE3Qih/fblbHGb4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)