UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IjUFe2AJ15tkSkG0cj97+iJTXBTf3c1BTRPdYKtTsZE=' 
WHERE 
  key_id = '21e413255bedbee5836248f686300715acf9a333e8e6a5f1c397c727a38715c3' 
  AND (
    token = 'IjUFe2AJ15tkSkG0cj97+iJTXBTf3c1BTRPdYKtTsZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032