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