UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R0Fi4ncXiXg094K7D190ntzDAZs6V5hHHS45v2fSWZg=' 
WHERE 
  key_id = '5beaacdbea94f1da6dd0747930686eb85ba3ee339147cf540b84036765ad0b50' 
  AND (
    token = 'R0Fi4ncXiXg094K7D190ntzDAZs6V5hHHS45v2fSWZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039