UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '47Zd6bXGQXhx2uIFCOTk3mZkqyF8SOICZcdt+sPP1oU='
WHERE
key_id = 'eff477644e43bf05f9a8b66956a3dba4bfdd0a69e91142be8a6ad4ce779a0cd7'
AND (
token = '47Zd6bXGQXhx2uIFCOTk3mZkqyF8SOICZcdt+sPP1oU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)