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

Query time 0.00045