UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OnV7Eep1mt2ps9fm45c7Klf5C2YOvq3iy76tSltQTyg='
WHERE
key_id = 'c389082712c206f4393bbb9002a659ae5b5cd615489cc64df4d7e12973121902'
AND (
token = 'OnV7Eep1mt2ps9fm45c7Klf5C2YOvq3iy76tSltQTyg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)