UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZYk9yJCGb3oJn3jdKOg76mlP5LGNfbGPEb1/bVQwp4I=' 
WHERE 
  key_id = 'aff6b384cefb5c0a4b86706f969be845ec94eee385c31cfce8b7d7213634ec0c' 
  AND (
    token = 'ZYk9yJCGb3oJn3jdKOg76mlP5LGNfbGPEb1/bVQwp4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032