UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3SGDFGnyPFoOHHrk34ZULJoNlPuACpCE7ex2SYuf4wQ=' 
WHERE 
  key_id = 'b2e6bafa0939109c38649c38b3ccb5b25782f97bd2cf5873d881f1d2f46d29f9' 
  AND (
    token = '3SGDFGnyPFoOHHrk34ZULJoNlPuACpCE7ex2SYuf4wQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038