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