UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UBUkd18dd0M0M+CtMO2Eikf1qzawXKXUo3erkIts/2I=' 
WHERE 
  key_id = '0f21e581f5c3883ee347314403d7e8d3593dacf72b39474d2edb82ab100d965d' 
  AND (
    token = 'UBUkd18dd0M0M+CtMO2Eikf1qzawXKXUo3erkIts/2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015