UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CFKLyX6+URyncetMXR6VjZOD78Nv9DvEgFjU1PSKuxU='
WHERE
key_id = '6973d389b7b9733b909579c1bf8ba38c5ffcfc191a4740bc5165910810a7ffd0'
AND (
token = 'CFKLyX6+URyncetMXR6VjZOD78Nv9DvEgFjU1PSKuxU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)