UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iRBrrUrHJ4hWR/5CrdPPXU5lWG66MPUHL6ag+8C1Bag=' 
WHERE 
  key_id = '1223d36c5222f9480f8343a20ff884fd382e883567f2ff05fd9dc4c6852ad032' 
  AND (
    token = 'iRBrrUrHJ4hWR/5CrdPPXU5lWG66MPUHL6ag+8C1Bag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020