UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2i4j8MI2a+s33Hs0U5dssf4Oeq3l+FjW31OshFhFVVM=' 
WHERE 
  key_id = '9b19e6608754d7ca886691bf985ca4436b7539a50bede732a95bced2080da8d2' 
  AND (
    token = '2i4j8MI2a+s33Hs0U5dssf4Oeq3l+FjW31OshFhFVVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055