UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BbMc+ekVX+mtgy77U3fYsMwegQ4o2d33QKJ6prAX+4g=' 
WHERE 
  key_id = 'c55c1789dc3be23db517236c927d4f4c91c5605cc46c301c96c69e522ee707f4' 
  AND (
    token = 'BbMc+ekVX+mtgy77U3fYsMwegQ4o2d33QKJ6prAX+4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038