UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r6u0j2rnhGRqeu86t3bgiO8QE/qhnzbRZE9b1y7Q+uw=' 
WHERE 
  key_id = '02a71d64ce6fb9168a4781c8822a932daa4e550abaa00f18f32aa1ea17eb32d7' 
  AND (
    token = 'r6u0j2rnhGRqeu86t3bgiO8QE/qhnzbRZE9b1y7Q+uw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018