UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gMuWv84QhOB+N4ip8FrV5NEBqku0lKJz3282RYdMPD4='
WHERE
key_id = 'b8538ba0367da64458c482e8c82cfeb10f18ce1ebd18565f6d5569593fb64875'
AND (
token = 'gMuWv84QhOB+N4ip8FrV5NEBqku0lKJz3282RYdMPD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)